//
// Created by twetec on 25-6-21.
//

#ifndef NETWORK_PROBER_RPC_PERCEPTION_RPC_CLIENT_H
#define NETWORK_PROBER_RPC_PERCEPTION_RPC_CLIENT_H

#include "../../../src/perception_rpc_caller_instruction.h"
#include "../../../src/perception_rpc_caller_register_probe.h"
#include "../../../src/perception_rpc_caller_sustain_probe_target.h"
#include "../../../src/perception_rpc_caller_sustain_probe_info.h"
#include "../../../src/perception_rpc_caller_backup_data_report.h"

namespace network_prober::database
{
class ProbeTaskResultModel;
class BackupTaskResultModel;
}

namespace network_prober::rpc
{
class PerceptionRPCClient
{
public:
    /**
     * 注册rpc客户端
     */
    void registerProber();

    /**
     * 上报观测结果
     */
    void reportProbeTaskResultsToPerception(std::span<database::ProbeTaskResultModel> probeTaskResults);

    /**
     * 上报备份结果
     */
    void reportBackupTaskResultsToPerception(std::span<database::BackupTaskResultModel> backupTaskResults);

    /**
     * 获取实例
     */
    static PerceptionRPCClient &getInstance();

private:
    PerceptionRPCClient();  // 构造函数私有化
    ~PerceptionRPCClient(); // 析构函数私有化

    PerceptionRPCClient(const PerceptionRPCClient &) = delete;            // 禁用默认拷贝构造函数（初始化赋值时调用）
    PerceptionRPCClient &operator=(const PerceptionRPCClient &) = delete; // 禁用默认拷贝赋值（初始化后，再赋值时调用）

    PerceptionRPCClient(PerceptionRPCClient &&) = delete;            // 针对右值
    PerceptionRPCClient &operator=(PerceptionRPCClient &&) = delete; // 针对右值

private:
    /**
     * 调用 - 指令
     */
    PerceptionRPCCallerInstruction m_RPCCallerInstruction;
    /**
     * 调用 - 注册探针
     */
    PerceptionRPCCallerRegisterProbe m_RPCCallerRegisterProbe;
    /**
     * 调用 - 观测
     */
    PerceptionRPCCallerSustainProbeTarget m_RPCCallerSustainProbeTarget;
    /**
     * 调用 - 备份
     */
    PerceptionRPCCallerBackupDataReport m_RPCCallerBackupDataReport;
    /**
     * 调用 - 上报运行参数
     */
    PerceptionRPCCallerSustainProbeInfo m_RPCCallerSustainProbeInfo;
};

}

#endif //NETWORK_PROBER_RPC_PERCEPTION_RPC_CLIENT_H
